<template>
  <div class="home">
    主页<h1>{{$route.params.mycid}}</h1>
    <h1>{{$store.state.num}}</h1>
    <h1>{{$store.getters.num}}</h1>
    <h1>{{mynum}}</h1>
    <button @click="change">使用mutations改变</button>
    <button @click="actionChange">使用actions改变 +10</button>
    <button @click="login">登录</button>
  </div>
</template>

<script>


export default {
  name: "Home",
  mounted () {
    console.log(this.$route.params.mycid)
  },
  methods: {
    login () {
      localStorage.token = "asdhfkahsldhfshsadkjfhlaksd"
    },
    change () {
      this.$store.commit("changeNum", 5)
    },
    actionChange () {
      this.$store.dispatch("numActions", 10)
    }
  },
  computed: {
    mynum () {
      return this.$store.getters.num
    }
  },
  components: {

  }
};
</script>
